<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'product-form',
    //'enableAjaxValidation' => false,
    'enableClientValidation' => true,
    'htmlOptions' => array(
        'enctype' => 'multipart/form-data',
        'class' => 'form-horizontal',
    ),
        ));
?>
<div class="tabbable">

    <div class="tab-content">
        <div class="row-fluid">
            <div class="span12">
                <!--PAGE CONTENT BEGINS-->
                <?php
                $cate = MyFunctionCustom::getCategoryParent();
                //echo "<pre>";print_r($menu);
                if (count($cate) > 0):
                    ?>
                    <div class="control-group">
                        <label class="control-label">Danh mục sản phẩm</label>
                        <div class="controls">
                            <select id="product" name="Product[category_id]">
                                <option value="">--</option>
                                <?php
                                foreach ($cate as $k => $m) {
                                    echo "<option value='" . $k . "'>" . $cate[$k] . "</option>";
                                }
                                ?>
                            </select>
                            <span class="help-inline"><?php echo $form->error($model, 'parent'); ?></span>
                        </div>
                    </div>                    
                <?php endif; ?>

                <div class="control-group">
                    <label class="control-label">Tên sản phẩm</label>
                    <div class="controls">
                        <?php echo $form->textField($model, "name", array('size' => 60, 'maxlength' => 100, 'class' => 'span5', 'placeholder' => 'Tên sản phẩm')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'order'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">Hình Đại Diện</label>
                    <div class="controls span4">
                        <?php echo $form->fileField($model, 'cover_image', array('class' => 'id-input-file-1 span5')); ?>
                        <span class="help-inline" style="float:left;margin-left:390px;"><?php echo $form->error($model, 'cover_image'); ?></span>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">Trạng thái</label>
                    <div class="controls">
                        <select class="span3" name="Product[active]">
                            <option value="1">Hiện</option>
                            <option value="0">Ẩn</option>
                        </select>
                        <span class="help-inline"><?php echo $form->error($model, 'active'); ?></span>
                    </div>
                </div>
                <div class="control-group" >
                    <label class="control-label">Mô tả sản phẩm</label>
                        <div class="controls">
                            <span class="help-inline"><?php echo $form->error($model, 'description'); ?></span>
                        </div>
                    </div>       
                    <?php
                    $this->widget('ext.editMe.ExtEditMe', array(
//                                                          'name' => 'Cms[description_'.$key .']',
                    'id' => 'description',
                    'height' => '250px',
                    'width' => '100%',
                    'model' => $model,
                    'attribute' => "description",
                    'toolbar' => Yii::app()->params['ckeditor'],
                    'filebrowserBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html',
                    'filebrowserImageBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Images',
                    'filebrowserFlashBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Flash',
                    'filebrowserUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                    'filebrowserImageUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                    'filebrowserFlashUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',
                    ));
                    ?> 
                <div class="clear"></div>
                <div class="form-actions">
                    <button class="btn btn-info" type="submit">
                        <i class="icon-ok bigger-110"></i>
                        Submit
                    </button>
                </div>
            </div>
            <!--PAGE CONTENT ENDS-->
        </div><!--/.span-->
    </div><!--/.row-fluid-->    

</div>
<?php $this->endWidget(); ?>
